{#
 # ---------------------------------------------------------------------
 #
 # GLPI - Gestionnaire Libre de Parc Informatique
 #
 # http://glpi-project.org
 #
 # @copyright 2015-2025 Teclib' and contributors.
 # @copyright 2003-2014 by the INDEPNET Development Team.
 # @licence   https://www.gnu.org/licenses/gpl-3.0.html
 #
 # ---------------------------------------------------------------------
 #
 # LICENSE
 #
 # This file is part of GLPI.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #
 # ---------------------------------------------------------------------
 #}

{% extends 'generic_show_form.html.twig' %}
{% import 'components/form/fields_macros.html.twig' as fields %}
{% import 'components/form/basic_inputs_macros.html.twig' as inputs %}

{% block form_fields %}
    {{ fields.textField('name', item.fields['name'], __('Name')) }}
    {{ fields.dropdownYesNo('is_active', item.fields['is_active'], __('Active')) }}

    {% set db_inst_field %}
        {% if _request['databaseinstances_id'] is not empty %}
            {{ get_item_link(database_instance) }}
            {{ inputs.hidden('databaseinstances_id', item.fields['databaseinstances_id']) }}
        {% else %}
            {{ fields.dropdownField('DatabaseInstance', 'databaseinstances_id', item.fields['databaseinstances_id'], null, {
                no_label: true,
                mb: ''
            }) }}
        {% endif %}
    {% endset %}
    {{ fields.htmlField('', db_inst_field, 'DatabaseInstance'|itemtype_name) }}
    {{ fields.numberField('size', item.fields['size'], __('%1$s (%2$s)')|format(__('Size'), __('Mio'))) }}

    {{ fields.dropdownYesNo('is_onbackup', item.fields['is_onbackup'], __('Has backup')) }}
    {{ fields.datetimeField('date_lastbackup', item.fields['date_lastbackup'], __('Last backup date'), {
        clearable: true
    }) }}
{% endblock %}
